coffee   = require('gulp-coffee')
gutil    = require('gulp-util')
notifier = require("node-notifier")

module.exports = ->
    coffee({bare: true}).on 'error', (err) ->
        gutil.log "#{err.plugin}: #{gutil.colors.red(err.name)} (#{err.message}):"
        gutil.log err.stack
        notifier.notify({title: "#{err.plugin}: #{err.name}", message: err.message})

        # 为了不中断gulp对coffee的watch，发出end信号，参见：
        # http://stackoverflow.com/questions/23971388/prevent-errors-from-breaking-crashing-gulp-watch
        this.emit 'end'

